﻿using System;
using System.Data;

namespace Smatime.Web.Models
{
    public class TotalWorkOfStaff : BaseEntity
    {
        public long CompanyId { get; set; }
        public string Name { get; set; }
        public TimeSpan? CheckIn { get; set; }
        public TimeSpan? CheckOut { get; set; }
        public string StoreName { get; set; }
        public long StoreId { get; set; }
        public int ContractType { get; set; }
        public DateTime StampDate { get; set; }
        public TimeSpan? TotalWork { get; set; }
        public TimeSpan? TotalBeark { get; set; }
        public TimeSpan? TotalGoOut { get; set; }

        public override BaseEntity FromDataRow(DataRow row)
        {
            Id = (long) row["Id"];
            CompanyId = (long) row["CompanyId"];
            Name = row["Name"].ToString();
            CheckIn = row["CheckIn"].ToTimeSpan();
            CheckOut = row["CheckOut"].ToTimeSpan();
            StoreName = row["StoreName"].ToString();
            StoreId = (long) row["StoreId"];
            StampDate = (DateTime) row["StampDate"];
            ContractType = (int) row["ContractType"];
            TotalWork = row["TotalWork"].ToTimeSpan();
            TotalBeark = row["TotalBeark"].ToTimeSpan();
            TotalGoOut = row["TotalGoOut"].ToTimeSpan();

            return base.FromDataRow(row);
        }
    }
}